package com.xuecheng.system.convert;

import com.xuecheng.api.system.model.dto.DictionaryDTO;
import com.xuecheng.system.entity.Dictionary;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * ps：导入依赖
 * 1.在接口类上加注解
 * 2通过mapstruct的api方法生成实现类
 * 3.添加要转换的方法
 * @author wuyunyun
 * @data 2021/10/7 20:59
 */

@Mapper
public interface DictionaryConvert {

    DictionaryConvert INSTANCE = Mappers.getMapper(DictionaryConvert.class);

    @Mapping(source = "id",target = "dicId")
    DictionaryDTO entity2dto(Dictionary dictionary);

    List<DictionaryDTO> entitys2dtos(List<Dictionary> dictionarys);

}
